package com.ncr.travel.appmgr.client.view;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiTemplate;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PushButton;
import com.google.gwt.user.client.ui.TabLayoutPanel;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.ncr.travel.appmgr.client.mvp.EventBus;
import com.ncr.travel.appmgr.client.presenter.MainWindowPresenter;

public class MainCompositeViewImpl extends Composite implements MainCompositeView {
	private static MainCompositeUiBinder uiBinder = GWT.create(MainCompositeUiBinder.class);

	@UiTemplate("MainCompositeView.ui.xml")
	interface MainCompositeUiBinder extends UiBinder<Widget, MainCompositeViewImpl> {
	}
	private MainWindowPresenter presenter;

	@UiField
	TabLayoutPanel appMgrTabPanel;
	@UiField
	Label timeLabel;
	@UiField
	PushButton logOutBtn;
	@UiField
	MainWindowViewImpl mainWindow;

	private EventBus eventBus;
	
	@Inject
	public MainCompositeViewImpl(EventBus eventBus) {
		initWidget(uiBinder.createAndBindUi(this));
		this.eventBus = eventBus;
		System.out.println("Constructing MainCompositeViewImpl");
//		TabBar appMgrTabBar = appMgrTabPanel.getTabBar();
//		appMgrTabBar.setStyleName("customizedTabBar");
//		Tab item = appMgrTabBar.getTab(1);
		
	}

	@Override
	public TabLayoutPanel getAppMgrTabPanel() {
		return appMgrTabPanel;
	}

	@Override
	public void setPresenter(MainWindowPresenter presenter) {
		this.presenter = presenter;
	}

	public MainWindowPresenter getPresenter() {
		return this.presenter;
	}

	@Override
	public TabLayoutPanel getProductsTabPanel() {
		return (TabLayoutPanel) mainWindow.getProductsTabPanel();
	}
}
